package cn.com.czpb.client.module.news.view;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;

import cn.com.czpb.client.R;
import cn.com.czpb.client.utils.PageCtrl;

/**
 * Created by 猪猪侠 on 2017/7/25.
 */

public class TopViewMain implements View.OnClickListener {
    private View rootView;
    private Activity mActivity;
    private LinearLayout ll_id_1;
    private LinearLayout ll_id_2;
    private LinearLayout ll_id_3;
    private LinearLayout ll_id_4;

    public static TopViewMain instance(Activity activity){
        return new TopViewMain(activity);
    }

    public TopViewMain(Activity activity){
        //
        this.mActivity = activity;
        initView(activity);
    }

    public View getView(){
        return rootView;
    }
    /**
     * @param context
     */
    private void initView(Activity context) {
        LayoutInflater layoutInflater = LayoutInflater.from(context);
        rootView = layoutInflater.inflate(R.layout.view_main,null);
        ll_id_1 = rootView.findViewById(R.id.ll_id_1);
        ll_id_2 = rootView.findViewById(R.id.ll_id_2);
        ll_id_3 = rootView.findViewById(R.id.ll_id_3);
        ll_id_4 = rootView.findViewById(R.id.ll_id_4);
        ll_id_1.setOnClickListener(this);
        ll_id_2.setOnClickListener(this);
        ll_id_3.setOnClickListener(this);
        ll_id_4.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.ll_id_1://高层
                PageCtrl.start2HighriseActivity(mActivity);
                break;
            case R.id.ll_id_2://政务
                PageCtrl.start2ZhengWuActivity(mActivity);
                break;
            case R.id.ll_id_3://党务
                PageCtrl.start2DangWuActivity(mActivity);
                break;
            case R.id.ll_id_4://服务
                PageCtrl.start2FuwuActivity(mActivity);
                break;
        }
    }

}
